import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/Login.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/login',
  },
  {
   path: '/login',
   name:'/loginPage',
   component:login
  },
  {
    path: '/home',
    name: 'homePage',
    redirect:'/home/table',
    component: () => import('../views/Home.vue'),
    children:[
     { path:'/home/table',name:'tablePage',component:()=>import('../views/TableManage.vue')},
     { path:'/home/greens',name:'greensPage',component:()=>import('../views/GreensManage.vue')},
     { path:'/home/member',name:'memberPage',component:()=>import('../views/MemberManage.vue')},
     { path:'/home/money',name:'moneyPage',component:()=>import('../views/MoneyManage.vue')},
     { path:'/home/order',name:'orderPage',component:()=>import('../views/OrderManage.vue')},
     { path:'/home/staff',name:'staffPage',component:()=>import('../views/StaffManage.vue')},
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
// router.beforeEach((to,from,next)=>{
//   next()
// })
export default router
